Get a time, second, minute or hour

Get a time, second, minute or hour

There are functions which you can use in your rules to get particular times, seconds, minutes or hours.

What do you want to do?

Get the second component of an input time

Get the minute component of an input time

Get the hour component of an input time

Get the time of day from a date and time

Get the time of day from a text string

Get the second component of an input time

To extract the second component of an input time (ie from a time of day variable or a date time variable), you use the Extract Second function. For example:

the second component of the submission time = ExtractSecond(16:30:42)

will infer the second component of the submission time to be 42. Note that the input time can be a constant as in this example, or a variable, as in the example below:

the second component of the submission time = ExtractSecond(the submission time)

In all cases the value returned is a number.

Get the minute component of an input time

To extract the minute component of an input time (ie from a time of day variable or a date time variable), you use the Extract Minute function. For example:

the minute component of the submission time = ExtractMinute(16:30:42)

will infer the minute component of the submission time to be 30. Note that the input time can be a constant as in this example, or a variable, as in the example below:

the minute component of the submission time = ExtractMinute(the submission time)

In all cases the value returned is a number.

Get the hour component of an input time

To extract the hour component of an input time (ie from a time of day variable or a date time variable), you use the Extract Hour function. For example:

the hour component of the submission time = ExtractHour(16:30:42)

will infer the hour component of the submission time to be 16. Note that the input time can be a constant as in this example, or a variable, as in the example below:

the hour component of the submission time = ExtractHour(the submission time)

In all cases the value returned is a number.

Get the time of day from a date and time

To extract the time of day from a date and time attribute, you use the Extract Time of Day function. For example, to determine the current time (ie at the start of the session), you would use the Current Date Time function and extract the time from it using the Extract Time of Day function:

the current time = ExtractTimeOfDay(the current date time)

This will infer the current time to be 15:30:00 if the rule is run on 2008-12-12 at 15:30:00.

Get the time of day from a text string

To convert a text string into a time of day variable, you use the Time Of Day function. For example:

the latest submission time = TimeOfDay("17:00:00")

will infer the latest submission time to be 17:00:00 if the text string is "17:00:00".

 

See also: